<extend name="Public/base"/>

<block name="body">
  <div class="form-fl">
    <!-- 标题栏 -->
    <div class="main-title">
      <h2>自定义菜单</h2>
    </div>
    <!-- 按钮工具栏 -->
    <div class="tb-unit-bar">
      <div class="btn-group">
        <a class="btn item_add" href="{:U('WechatMenu/add', array('model' => $model_list['id']))}">新 增</a>
        <button url="{:U('WechatMenu/del')}" class="btn ajax-post confirm" target-form="ids">删 除</button>
        <button url="{:U('WechatMenu/send')}" class="btn ajax-post" target-form="ids">生成自定义菜单</button>
        <button url="{:U('WechatMenu/remove')}" class="btn ajax-post confirm" target-form="ids" title="删除微信上已存在的自定义菜单">删除自定义菜单</button>
      </div>
    </div>

    <!-- 数据表格 -->
    <div class="data-table">
      <table>
        <!-- 表头 -->
        <thead>
          <tr>
            <th class="row-selected">
              <input class="check-all" type="checkbox">
            </th>
            <th>ID</th>
            <th>名称</th>
            <th>排序</th>
            <th>操作</th>
          </tr>
        </thead>

        <!-- 列表 -->
        <tbody class="category">
        <notempty name="lists.menu">
          <volist name="lists.menu" id="vo">
            <tr>
              <td><input class="ids" type="checkbox" value="{$vo['id']}" name="ids[]"></td>
              <td>{$vo.id}</td>
              <td>{$vo.title}</td>
              <td>{$vo.sort}</td>
              <td>
                <a href="{:U('edit?id='.$vo['id'])}">[编辑]</a>
                <a class="confirm ajax-get" title="删除" href="{:U('del',array('ids'=>$vo['id']))}">[删除]</a>
              </td>
            </tr>
          </volist>
          <else />
          <td colspan="5" class="text-center"> aOh! 暂时没有自定义菜单!  <a href="{:U('add')}">立即添加&gt;</a></td>
        </notempty>
        </tbody>
      </table>
    </div>
    <!-- 分页 -->
    <div class="page">
      {$_page}
    </div>
  </div>

  <div class="form-fr">
    <div class="wechat">
      <div class="tool-bar">{:session('default_wx_mpname')}</div>
      <div class="side-bar J_menulist">
        <ul>
          <volist name="lists.tree" id="vo">
            <li class="item-{$lists.num}">
              <a href="{$vo.url}" target="_blank"><notempty name='vo.sub'><i class="icon-list"></i></notempty>{$vo.title}</a>
            <notempty name='vo.sub'>
              <div class="sub_button">
                <ul>
                  <volist name="vo.sub" id="vl">
                    <li><a href="{$vl.url}" target="_blank">{$vl.title}</a></li>
                  </volist>
                </ul>
                <span class="arrow-bottom"></span>
              </div>
            </notempty>
            </li>
          </volist>
        </ul>
      </div>
    </div>
    <p class="preview">预览</p>
  </div> 
</block>

<block name="script">
  <script src="__JS__/lib/wechat.js"></script>
  <script type="text/javascript">
    $(function(){
      wechat_menu.init();
      Core.setValue('mid', '{$mid|default = 0}');
    });
  </script>
</block>
